{
gboolean ret = FALSE;
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
- gs_unref_object GFile* efi_basedir = NULL;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GFile) efi_basedir = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
if (g_file_query_exists (self->config_path_bios, NULL))
{
if (g_file_query_exists (efi_basedir, NULL))
{
- gs_unref_object GFileEnumerator *direnum = NULL;
+ g_autoptr(GFileEnumerator) direnum = NULL;
direnum = g_file_enumerate_children (efi_basedir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
gboolean ret = FALSE;
GString *output = g_string_new ("");
- gs_unref_object GOutputStream *out_stream = NULL;
+ g_autoptr(GOutputStream) out_stream = NULL;
gs_unref_ptrarray GPtrArray *loader_configs = NULL;
guint i;
gsize bytes_written;
{
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
gboolean ret = FALSE;
- gs_unref_object GFile *efi_new_config_temp = NULL;
- gs_unref_object GFile *efi_orig_config = NULL;
- gs_unref_object GFile *new_config_path = NULL;
+ g_autoptr(GFile) efi_new_config_temp = NULL;
+ g_autoptr(GFile) efi_orig_config = NULL;
+ g_autoptr(GFile) new_config_path = NULL;
gs_unref_object GSSubprocessContext *procctx = NULL;
gs_unref_object GSSubprocess *proc = NULL;
gs_strfreev char **child_env = g_get_environ ();
g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
- gs_unref_object GFile *config_path_efi_dir = NULL;
+ g_autoptr(GFile) config_path_efi_dir = NULL;
g_autofree char *grub2_mkconfig_chroot = NULL;
if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
{
gs_unref_ptrarray GPtrArray *deployments = NULL;
OstreeDeployment *tool_deployment;
- gs_unref_object GFile *tool_deployment_root = NULL;
+ g_autoptr(GFile) tool_deployment_root = NULL;
deployments = ostree_sysroot_get_deployments (self->sysroot);
if (self->is_efi)
{
- gs_unref_object GFile *config_path_efi_old = g_file_get_child (config_path_efi_dir, "grub.cfg.old");
+ g_autoptr(GFile) config_path_efi_old = g_file_get_child (config_path_efi_dir, "grub.cfg.old");
/* copy current to old */
if (!ot_gfile_ensure_unlinked (config_path_efi_old, cancellable, error))
{
gboolean ret = FALSE;
OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader);
- gs_unref_object GFile *new_config_path = NULL;
+ g_autoptr(GFile) new_config_path = NULL;
g_autofree char *config_contents = NULL;
g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL;
GError **error)
{
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
- gs_unref_object GFile *new_config_path = NULL;
+ g_autoptr(GFile) new_config_path = NULL;
g_autofree char *config_contents = NULL;
g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL;
gboolean ret = FALSE;
gpointer header_data;
gsize header_size;
- gs_unref_object GInputStream *ret_input = NULL;
+ g_autoptr(GInputStream) ret_input = NULL;
gs_unref_variant GVariant *file_header = NULL;
gs_unref_ptrarray GPtrArray *streams = NULL;
- gs_unref_object GOutputStream *header_out_stream = NULL;
- gs_unref_object GInputStream *header_in_stream = NULL;
+ g_autoptr(GOutputStream) header_out_stream = NULL;
+ g_autoptr(GInputStream) header_in_stream = NULL;
file_header = file_header_new (file_info, xattrs);
guint32 archive_header_size;
guchar dummy[4];
gsize bytes_read;
- gs_unref_object GInputStream *ret_input = NULL;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GInputStream) ret_input = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
gs_unref_variant GVariant *file_header = NULL;
g_autofree guchar *buf = NULL;
**/
if (compressed)
{
- gs_unref_object GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
+ g_autoptr(GConverter) zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
ret_input = g_converter_input_stream_new (input, zlib_decomp);
}
else
{
gboolean ret = FALSE;
struct stat stbuf;
- gs_unref_object GInputStream *file_input = NULL;
- gs_unref_object GInputStream *ret_input = NULL;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GInputStream) file_input = NULL;
+ g_autoptr(GInputStream) ret_input = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
if (!ot_openat_read_stream (parent_dfd, path, TRUE, &file_input,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileInfo *file_info = NULL;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
+ g_autoptr(GInputStream) in = NULL;
gs_unref_variant GVariant *xattrs = NULL;
g_autofree guchar *ret_csum = NULL;
gboolean ret = FALSE;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
g_variant_get (metadata, "(uuuu&s@a(ayay))",
guint64 size;
guint32 uid, gid, mode, rdev;
const char *symlink_target;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size,
else
{
gs_unref_variant GVariant *xattrs = NULL;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GInputStream) in = NULL;
if (!(flags & OSTREE_DIFF_FLAGS_IGNORE_XATTRS))
{
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *child = NULL;
- gs_unref_object GFileInfo *child_info = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) child = NULL;
+ g_autoptr(GFileInfo) child_info = NULL;
dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *child_a = NULL;
- gs_unref_object GFile *child_b = NULL;
- gs_unref_object GFileInfo *child_a_info = NULL;
- gs_unref_object GFileInfo *child_b_info = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) child_a = NULL;
+ g_autoptr(GFile) child_b = NULL;
+ g_autoptr(GFileInfo) child_a_info = NULL;
+ g_autoptr(GFileInfo) child_b_info = NULL;
if (a == NULL)
{
if (fetcher->client_cert)
{
#ifdef HAVE_LIBSOUP_CLIENT_CERTS
- gs_unref_object GTlsInteraction *interaction =
+ g_autoptr(GTlsInteraction) interaction =
(GTlsInteraction*)_ostree_tls_cert_interaction_new (fetcher->client_cert);
g_object_set (fetcher->session, "tls-interaction", interaction, NULL);
#else
* guaranteed to do a complete write.
*/
{
- gs_unref_object GInputStream *membuf =
+ g_autoptr(GInputStream) membuf =
g_memory_input_stream_new_from_bytes (bytes);
g_output_stream_splice_async (pending->out_stream, membuf,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gboolean ret = FALSE;
const guint8 nulchar = 0;
g_autofree char *ret_contents = NULL;
- gs_unref_object GMemoryOutputStream *buf = NULL;
+ g_autoptr(GMemoryOutputStream) buf = NULL;
FetchUriSyncData data;
g_assert (error != NULL);
gboolean ret = FALSE;
OstreeGpgVerifier *self = (OstreeGpgVerifier*)initable;
const char *default_keyring_path = g_getenv ("OSTREE_GPG_HOME");
- gs_unref_object GFile *default_keyring_dir = NULL;
+ g_autoptr(GFile) default_keyring_dir = NULL;
if (!default_keyring_path)
default_keyring_path = DATADIR "/ostree/trusted.gpg.d/";
gpgme_data_t data_buffer = NULL;
gpgme_data_t signature_buffer = NULL;
g_autofree char *tmp_dir = NULL;
- glnx_unref_object GOutputStream *target_stream = NULL;
+ g_autoptr(GOutputStream) target_stream = NULL;
OstreeGpgVerifyResult *result = NULL;
gboolean success = FALSE;
GList *link;
for (link = self->keyrings; link != NULL; link = link->next)
{
- glnx_unref_object GFileInputStream *source_stream = NULL;
+ g_autoptr(GFileInputStream) source_stream = NULL;
GFile *keyring_file = link->data;
gssize bytes_written;
GError *local_error = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *enumerator = NULL;
+ g_autoptr(GFileEnumerator) enumerator = NULL;
enumerator = g_file_enumerate_children (path, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NONE,
GCancellable *cancellable,
GError **error)
{
- gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
+ g_autoptr(GFile) proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
g_autofree char *proc_cmdline = NULL;
gsize proc_cmdline_len = 0;
gs_strfreev char **proc_cmdline_args = NULL;
GError *local_error = NULL;
struct stat stbuf;
int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher);
- gs_unref_object GInputStream *instream = NULL;
+ g_autoptr(GInputStream) instream = NULL;
g_autofree char *result = NULL;
GChecksum *checksum = NULL;
{
gboolean ret = FALSE;
g_autofree char *temp_filename = NULL;
- gs_unref_object GOutputStream *temp_out = NULL;
+ g_autoptr(GOutputStream) temp_out = NULL;
int fd;
int res;
guint32 file_mode;
}
else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
- gs_unref_object GOutputStream *temp_out = NULL;
+ g_autoptr(GOutputStream) temp_out = NULL;
int fd;
guint32 file_mode;
}
else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
- gs_unref_object GOutputStream *temp_out = NULL;
+ g_autoptr(GOutputStream) temp_out = NULL;
guint32 file_mode;
file_mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
gboolean can_cache;
gboolean did_hardlink = FALSE;
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
- gs_unref_object GInputStream *input = NULL;
+ g_autoptr(GInputStream) input = NULL;
gs_unref_variant GVariant *xattrs = NULL;
is_symlink = g_file_info_get_file_type (source_info) == G_FILE_TYPE_SYMBOLIC_LINK;
int destination_dfd = -1;
int res;
gs_unref_variant GVariant *xattrs = NULL;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
/* Create initially with mode 0700, then chown/chmod only when we're
* done. This avoids anyone else being able to operate on partially
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile* commit_root = NULL;
- gs_unref_object GFile* target_dir = NULL;
- gs_unref_object GFileInfo* target_info = NULL;
+ g_autoptr(GFile) commit_root = NULL;
+ g_autoptr(GFile) target_dir = NULL;
+ g_autoptr(GFileInfo) target_info = NULL;
OstreeRepoCheckoutOptions default_options = { 0, };
if (!options)
g_hash_table_iter_init (&iter, to_clean_dirs);
while (to_clean_dirs && g_hash_table_iter_next (&iter, &key, &value))
{
- gs_unref_object GFile *objdir = NULL;
- gs_unref_object GFileEnumerator *enumerator = NULL;
+ g_autoptr(GFile) objdir = NULL;
+ g_autoptr(GFileEnumerator) enumerator = NULL;
g_autofree char *objdir_name = NULL;
objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
nlinks = g_file_info_get_attribute_uint32 (file_info, "unix::nlink");
if (nlinks == 1)
{
- gs_unref_object GFile *objpath = NULL;
+ g_autoptr(GFile) objpath = NULL;
objpath = g_file_get_child (objdir, g_file_info_get_name (file_info));
if (!gs_file_unlink (objpath, cancellable, error))
goto out;
{
gboolean ret = FALSE;
g_autofree char *temp_filename = NULL;
- gs_unref_object GOutputStream *ret_stream = NULL;
+ g_autoptr(GOutputStream) ret_stream = NULL;
gboolean have_obj;
char loose_objpath[_OSTREE_LOOSE_PATH_MAX];
gboolean do_commit;
OstreeRepoMode repo_mode;
g_autofree char *temp_filename = NULL;
- gs_unref_object GFile *stored_path = NULL;
+ g_autoptr(GFile) stored_path = NULL;
g_autofree guchar *ret_csum = NULL;
gs_unref_object OstreeChecksumInputStream *checksum_input = NULL;
- gs_unref_object GInputStream *file_input = NULL;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GInputStream) file_input = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_unref_object GOutputStream *temp_out = NULL;
+ g_autoptr(GOutputStream) temp_out = NULL;
gboolean have_obj;
GChecksum *checksum = NULL;
gboolean temp_file_is_regular;
else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
{
gs_unref_variant GVariant *file_meta = NULL;
- gs_unref_object GConverter *zlib_compressor = NULL;
- gs_unref_object GOutputStream *compressed_out_stream = NULL;
+ g_autoptr(GConverter) zlib_compressor = NULL;
+ g_autoptr(GOutputStream) compressed_out_stream = NULL;
if (self->generate_sizes)
indexable = TRUE;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *enumerator = NULL;
+ g_autoptr(GFileEnumerator) enumerator = NULL;
guint64 curtime_secs;
enumerator = g_file_enumerate_children (self->tmp_dir, "standard::name,time::modified",
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GInputStream *input = NULL;
+ g_autoptr(GInputStream) input = NULL;
gs_unref_variant GVariant *normalized = NULL;
normalized = g_variant_get_normal_form (object);
GCancellable *cancellable,
GError **error)
{
- gs_unref_object GInputStream *input = NULL;
+ g_autoptr(GInputStream) input = NULL;
gs_unref_variant GVariant *normalized = NULL;
normalized = g_variant_get_normal_form (variant);
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *metadata_path =
+ g_autoptr(GFile) metadata_path =
_ostree_repo_get_commit_metadata_loose_path (self, checksum);
gs_unref_variant GVariant *ret_metadata = NULL;
GError *temp_error = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *metadata_path =
+ g_autoptr(GFile) metadata_path =
_ostree_repo_get_commit_metadata_loose_path (self, checksum);
gs_unref_variant GVariant *normalized = NULL;
gsize normalized_size = 0;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *child = NULL;
- gs_unref_object GFileInfo *modified_info = NULL;
+ g_autoptr(GFile) child = NULL;
+ g_autoptr(GFileInfo) modified_info = NULL;
gs_unref_object OstreeMutableTree *child_mtree = NULL;
g_autofree char *child_relpath = NULL;
const char *name;
{
guint64 file_obj_length;
const char *loose_checksum;
- gs_unref_object GInputStream *file_input = NULL;
+ g_autoptr(GInputStream) file_input = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_unref_object GInputStream *file_object_input = NULL;
+ g_autoptr(GInputStream) file_object_input = NULL;
g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
gboolean ret = FALSE;
OstreeRepoCommitFilterResult filter_result;
OstreeRepoFile *repo_dir = NULL;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFileInfo *child_info = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFileInfo) child_info = NULL;
if (dir)
g_debug ("Examining: %s", gs_file_get_path_cached (dir));
}
else
{
- gs_unref_object GFileInfo *modified_info = NULL;
+ g_autoptr(GFileInfo) modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
{
- gs_unref_object GFileEnumerator *dir_enum = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
dir_enum = g_file_enumerate_children ((GFile*)dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileInfo *child_info = NULL;
- gs_unref_object GFileInfo *modified_info = NULL;
+ g_autoptr(GFileInfo) child_info = NULL;
+ g_autoptr(GFileInfo) modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
{
struct dirent *dent;
struct stat stbuf;
- gs_unref_object GFileInfo *child_info = NULL;
+ g_autoptr(GFileInfo) child_info = NULL;
const char *loose_checksum;
if (!gs_dirfd_iterator_next_dent (src_dfd_iter, &dent, cancellable, error))
GHashTableIter hash_iter;
gpointer key, value;
const char *contents_checksum, *metadata_checksum;
- gs_unref_object GFile *ret_file = NULL;
+ g_autoptr(GFile) ret_file = NULL;
metadata_checksum = ostree_mutable_tree_get_metadata_checksum (mtree);
if (!metadata_checksum)
while (g_hash_table_iter_next (&hash_iter, &key, &value))
{
const char *name = key;
- gs_unref_object GFile *child_file = NULL;
+ g_autoptr(GFile) child_file = NULL;
OstreeMutableTree *child_dir = value;
if (!ostree_repo_write_mtree (self, child_dir, &child_file,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileInfo *ret_info = NULL;
+ g_autoptr(GFileInfo) ret_info = NULL;
gs_unref_variant GVariant *metadata = NULL;
ret_info = g_file_info_new ();
gboolean ret = FALSE;
const char *name = NULL;
int c;
- gs_unref_object GFileInfo *ret_info = NULL;
+ g_autoptr(GFileInfo) ret_info = NULL;
gs_unref_variant GVariant *files_variant = NULL;
gs_unref_variant GVariant *dirs_variant = NULL;
gs_unref_variant GVariant *content_csum_v = NULL;
{
gboolean ret = FALSE;
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
- gs_unref_object GFileInfo *info = NULL;
+ g_autoptr(GFileInfo) info = NULL;
if (!ostree_repo_file_ensure_resolved (self, error))
goto out;
gboolean ret = FALSE;
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
const char *checksum;
- gs_unref_object GInputStream *ret_stream = NULL;
+ g_autoptr(GInputStream) ret_stream = NULL;
if (!ostree_repo_file_ensure_resolved (self, error))
goto out;
struct archive_entry *entry,
OstreeRepoCommitModifier *modifier)
{
- gs_unref_object GFileInfo *info = NULL;
+ g_autoptr(GFileInfo) info = NULL;
GFileInfo *modified_info = NULL;
const struct stat *st;
guint32 file_type;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GInputStream *file_object_input = NULL;
- gs_unref_object GInputStream *archive_stream = NULL;
+ g_autoptr(GInputStream) file_object_input = NULL;
+ g_autoptr(GInputStream) archive_stream = NULL;
guint64 length;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
const char *pathname;
const char *hardlink;
const char *basename;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
gs_unref_ptrarray GPtrArray *split_path = NULL;
gs_unref_ptrarray GPtrArray *hardlink_split_path = NULL;
gs_unref_object OstreeMutableTree *subdir = NULL;
struct archive *a = NULL;
struct archive_entry *entry;
int r;
- gs_unref_object GFileInfo *tmp_dir_info = NULL;
+ g_autoptr(GFileInfo) tmp_dir_info = NULL;
g_autofree guchar *tmp_csum = NULL;
a = archive_read_new ();
GError **error = &local_error;
GCancellable *cancellable = NULL;
guint64 length;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
- gs_unref_object GInputStream *file_in = NULL;
- gs_unref_object GInputStream *object_input = NULL;
+ g_autoptr(GInputStream) file_in = NULL;
+ g_autoptr(GInputStream) object_input = NULL;
g_autofree char *temp_path = NULL;
const char *checksum;
OstreeObjectType objtype;
OtPullData *pull_data = fetch_data->pull_data;
gs_unref_variant GVariant *metadata = NULL;
g_autofree char *temp_path = NULL;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GInputStream) in = NULL;
g_autofree char *actual_checksum = NULL;
g_autofree guint8 *csum = NULL;
GError *local_error = NULL;
}
else if (tls_client_cert_path)
{
- gs_unref_object GTlsCertificate *client_cert = NULL;
+ g_autoptr(GTlsCertificate) client_cert = NULL;
g_assert (tls_client_key_path);
{
g_autofree char *tls_ca_path = NULL;
- gs_unref_object GTlsDatabase *db = NULL;
+ g_autoptr(GTlsDatabase) db = NULL;
if (!_ostree_repo_get_remote_option (self,
remote_name_or_baseurl, "tls-ca-path",
if (strcmp (soup_uri_get_scheme (pull_data->base_uri), "file") == 0)
{
- gs_unref_object GFile *remote_repo_path = g_file_new_for_path (soup_uri_get_path (pull_data->base_uri));
+ g_autoptr(GFile) remote_repo_path = g_file_new_for_path (soup_uri_get_path (pull_data->base_uri));
pull_data->remote_repo_local = ostree_repo_new (remote_repo_path);
if (!ostree_repo_open (pull_data->remote_repo_local, cancellable, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *ret_file = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) ret_file = NULL;
dir_enum = g_file_enumerate_children (self->remote_heads_dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
__attribute__((unused)) GCancellable *cancellable = NULL;
GError *temp_error = NULL;
g_autofree char *ret_rev = NULL;
- gs_unref_object GFile *child = NULL;
+ g_autoptr(GFile) child = NULL;
g_return_val_if_fail (ref != NULL, FALSE);
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *enumerator = NULL;
+ g_autoptr(GFileEnumerator) enumerator = NULL;
enumerator = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
if (refspec_prefix)
{
- gs_unref_object GFile *dir = NULL;
- gs_unref_object GFile *child = NULL;
- gs_unref_object GFileInfo *info = NULL;
+ g_autoptr(GFile) dir = NULL;
+ g_autoptr(GFile) child = NULL;
+ g_autoptr(GFileInfo) info = NULL;
if (!ostree_parse_refspec (refspec_prefix, &remote, &ref_prefix, error))
goto out;
}
else
{
- gs_unref_object GFileEnumerator *remote_enumerator = NULL;
+ g_autoptr(GFileEnumerator) remote_enumerator = NULL;
if (!enumerate_refs_recurse (self, NULL, self->local_heads_dir, self->local_heads_dir,
ret_all_refs,
csizenames = g_hash_table_lookup (sizenames_map, checksum);
if (!csizenames)
{
- gs_unref_object GFileInfo *finfo = NULL;
+ g_autoptr(GFileInfo) finfo = NULL;
csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
csizenames->checksum = g_strdup (checksum);
{
gboolean ret = FALSE;
guint64 content_size;
- gs_unref_object GInputStream *content_stream = NULL;
- gs_unref_object GFileInfo *content_finfo = NULL;
+ g_autoptr(GInputStream) content_stream = NULL;
+ g_autoptr(GFileInfo) content_finfo = NULL;
gs_unref_variant GVariant *content_xattrs = NULL;
guint64 compressed_size;
OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
gs_fd_close int fd = -1;
gs_unref_bytes GBytes *ret_content = NULL;
- gs_unref_object GInputStream *istream = NULL;
- gs_unref_object GFileInfo *ret_finfo = NULL;
- gs_unref_object GOutputStream *out = NULL;
+ g_autoptr(GInputStream) istream = NULL;
+ g_autoptr(GFileInfo) ret_finfo = NULL;
+ g_autoptr(GOutputStream) out = NULL;
fd = g_mkstemp (tmpname);
if (fd == -1)
gs_unref_hashtable GHashTable *to_bsdiff = NULL;
gs_unref_bytes GBytes *tmp_from = NULL;
gs_unref_bytes GBytes *tmp_to = NULL;
- gs_unref_object GFileInfo *from_finfo = NULL;
- gs_unref_object GFileInfo *to_finfo = NULL;
+ g_autoptr(GFileInfo) from_finfo = NULL;
+ g_autoptr(GFileInfo) to_finfo = NULL;
ContentBsdiff *ret_bsdiff = NULL;
*out_bsdiff = NULL;
gs_unref_hashtable GHashTable *to_rollsum = NULL;
gs_unref_bytes GBytes *tmp_from = NULL;
gs_unref_bytes GBytes *tmp_to = NULL;
- gs_unref_object GFileInfo *from_finfo = NULL;
- gs_unref_object GFileInfo *to_finfo = NULL;
+ g_autoptr(GFileInfo) from_finfo = NULL;
+ g_autoptr(GFileInfo) to_finfo = NULL;
OstreeRollsumMatches *matches = NULL;
ContentRollsum *ret_rollsum = NULL;
{
gboolean ret = FALSE;
guint64 content_size;
- gs_unref_object GInputStream *content_stream = NULL;
- gs_unref_object GFileInfo *content_finfo = NULL;
+ g_autoptr(GInputStream) content_stream = NULL;
+ g_autoptr(GFileInfo) content_finfo = NULL;
gs_unref_variant GVariant *content_xattrs = NULL;
OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
const guint8 *tmp_to_buf;
{
gboolean ret = FALSE;
guint64 content_size;
- gs_unref_object GInputStream *content_stream = NULL;
- gs_unref_object GFileInfo *content_finfo = NULL;
+ g_autoptr(GInputStream) content_stream = NULL;
+ g_autoptr(GFileInfo) content_finfo = NULL;
gs_unref_variant GVariant *content_xattrs = NULL;
OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
const guint8 *tmp_to_buf;
struct bzdiff_opaque_s op;
const gchar *payload;
gssize payload_size;
- gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
+ g_autoptr(GOutputStream) out = g_memory_output_stream_new_resizable ();
stream.malloc = malloc;
stream.free = free;
stream.write = bzdiff_write;
GHashTableIter hashiter;
gpointer key, value;
OstreeStaticDeltaPartBuilder *current_part = NULL;
- gs_unref_object GFile *root_from = NULL;
+ g_autoptr(GFile) root_from = NULL;
gs_unref_variant GVariant *from_commit = NULL;
- gs_unref_object GFile *root_to = NULL;
+ g_autoptr(GFile) root_to = NULL;
gs_unref_variant GVariant *to_commit = NULL;
gs_unref_hashtable GHashTable *to_reachable_objects = NULL;
gs_unref_hashtable GHashTable *from_reachable_objects = NULL;
g_hash_table_add (new_reachable_metadata, serialized_key);
else
{
- gs_unref_object GFileInfo *finfo = NULL;
+ g_autoptr(GFileInfo) finfo = NULL;
GFileType ftype;
if (!ostree_repo_load_file (repo, checksum, NULL, &finfo, NULL,
}
else
{
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
if (!ostree_repo_query_object_storage_size (self, OSTREE_OBJECT_TYPE_FILE,
checksum,
gs_unref_variant GVariant *delta_descriptor = NULL;
gs_unref_variant GVariant *to_commit = NULL;
g_autofree char *descriptor_relpath = NULL;
- gs_unref_object GFile *descriptor_path = NULL;
- gs_unref_object GFile *descriptor_dir = NULL;
+ g_autoptr(GFile) descriptor_path = NULL;
+ g_autoptr(GFile) descriptor_dir = NULL;
gs_unref_variant GVariant *tmp_metadata = NULL;
gs_unref_variant GVariant *fallback_headers = NULL;
gs_free_checksum GChecksum *checksum = NULL;
gs_unref_bytes GBytes *objtype_checksum_array = NULL;
gs_unref_bytes GBytes *checksum_bytes = NULL;
- gs_unref_object GFile *part_tempfile = NULL;
- gs_unref_object GOutputStream *part_temp_outstream = NULL;
- gs_unref_object GInputStream *part_in = NULL;
- gs_unref_object GInputStream *part_payload_in = NULL;
- gs_unref_object GMemoryOutputStream *part_payload_out = NULL;
- gs_unref_object GConverterOutputStream *part_payload_compressor = NULL;
- gs_unref_object GConverter *compressor = NULL;
+ g_autoptr(GFile) part_tempfile = NULL;
+ g_autoptr(GOutputStream) part_temp_outstream = NULL;
+ g_autoptr(GInputStream) part_in = NULL;
+ g_autoptr(GInputStream) part_payload_in = NULL;
+ g_autoptr(GMemoryOutputStream) part_payload_out = NULL;
+ g_autoptr(GConverterOutputStream) part_payload_compressor = NULL;
+ g_autoptr(GConverter) compressor = NULL;
gs_unref_variant GVariant *delta_part_content = NULL;
gs_unref_variant GVariant *delta_part = NULL;
gs_unref_variant GVariant *delta_part_header = NULL;
{
GFile *tempfile = part_tempfiles->pdata[i];
g_autofree char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i);
- gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
+ g_autoptr(GFile) part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
if (!gs_file_rename (tempfile, part_path, cancellable, error))
goto out;
{
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *ret_deltas = NULL;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
ret_deltas = g_ptr_array_new_with_free_func (g_free);
while (TRUE)
{
- gs_unref_object GFileEnumerator *dir_enum2 = NULL;
+ g_autoptr(GFileEnumerator) dir_enum2 = NULL;
GFileInfo *file_info;
GFile *child;
name2 = gs_file_get_basename_cached (child2);
{
- gs_unref_object GFile *meta_path = g_file_get_child (child2, "superblock");
+ g_autoptr(GFile) meta_path = g_file_get_child (child2, "superblock");
if (g_file_query_exists (meta_path, NULL))
{
{
gboolean ret = FALSE;
guint i, n;
- gs_unref_object GFile *meta_file = g_file_get_child (dir, "superblock");
+ g_autoptr(GFile) meta_file = g_file_get_child (dir, "superblock");
gs_unref_variant GVariant *meta = NULL;
gs_unref_variant GVariant *headers = NULL;
gs_unref_variant GVariant *fallback = NULL;
gs_unref_variant GVariant *header = NULL;
gs_unref_variant GVariant *csum_v = NULL;
gs_unref_variant GVariant *objects = NULL;
- gs_unref_object GFile *part_path = NULL;
- gs_unref_object GInputStream *raw_in = NULL;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GFile) part_path = NULL;
+ g_autoptr(GInputStream) raw_in = NULL;
+ g_autoptr(GInputStream) in = NULL;
header = g_variant_get_child_value (headers, i);
g_variant_get (header, "(@aytt@ay)", &csum_v, &size, &usize, &objects);
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GInputStream *tmp_in = NULL;
+ g_autoptr(GInputStream) tmp_in = NULL;
g_autofree guchar *actual_checksum_bytes = NULL;
g_autofree char *actual_checksum = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GMemoryInputStream *memin = (GMemoryInputStream*)g_memory_input_stream_new_from_bytes (data);
- gs_unref_object GMemoryOutputStream *memout = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
- gs_unref_object GInputStream *convin = g_converter_input_stream_new ((GInputStream*)memin, converter);
+ g_autoptr(GMemoryInputStream) memin = (GMemoryInputStream*)g_memory_input_stream_new_from_bytes (data);
+ g_autoptr(GMemoryOutputStream) memout = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
+ g_autoptr(GInputStream) convin = g_converter_input_stream_new ((GInputStream*)memin, converter);
{
gssize n_bytes_written = g_output_stream_splice ((GOutputStream*)memout, convin,
break;
case 'x':
{
- gs_unref_object GConverter *decomp =
+ g_autoptr(GConverter) decomp =
(GConverter*) _ostree_lzma_decompressor_new ();
if (!decompress_all (decomp, part_payload_bytes, &payload_data,
{
gboolean ret = FALSE;
guint64 offset, length;
- gs_unref_object GInputStream *in_stream = NULL;
+ g_autoptr(GInputStream) in_stream = NULL;
g_autoptr(GMappedFile) input_mfile = NULL;
g_autofree guchar *buf = NULL;
struct bspatch_stream stream;
guint64 content_offset;
guint64 objlen;
gsize bytes_written;
- gs_unref_object GInputStream *object_input = NULL;
- gs_unref_object GInputStream *memin = NULL;
+ g_autoptr(GInputStream) object_input = NULL;
+ g_autoptr(GInputStream) memin = NULL;
if (!do_content_open_generic (repo, state, cancellable, error))
goto out;
else
{
/* Slower path, for symlinks and unpacking deltas into archive-z2 */
- gs_unref_object GFileInfo *finfo = NULL;
+ g_autoptr(GFileInfo) finfo = NULL;
finfo = _ostree_header_gfile_info_new (state->mode, state->uid, state->gid);
if (g_file_test ("objects", G_FILE_TEST_IS_DIR)
&& g_file_test ("config", G_FILE_TEST_IS_REGULAR))
{
- gs_unref_object GFile *cwd = g_file_new_for_path (".");
+ g_autoptr(GFile) cwd = g_file_new_for_path (".");
return ostree_repo_new (cwd);
}
else
{
const char *envvar = g_getenv ("OSTREE_REPO");
- gs_unref_object GFile *repo_path = NULL;
+ g_autoptr(GFile) repo_path = NULL;
if (envvar == NULL || *envvar == '\0')
repo_path = get_default_repo_path ();
gboolean
ostree_repo_is_system (OstreeRepo *repo)
{
- gs_unref_object GFile *default_repo_path = get_default_repo_path ();
+ g_autoptr(GFile) default_repo_path = get_default_repo_path ();
return g_file_equal (repo->repodir, default_repo_path);
}
{
const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d";
g_autofree char *basename = g_strconcat (name, ".conf", NULL);
- gs_unref_object GFile *etc_ostree_remotes_d = NULL;
+ g_autoptr(GFile) etc_ostree_remotes_d = NULL;
if (sysroot == NULL)
etc_ostree_remotes_d = g_file_new_for_path (sysconf_remotes);
{
gboolean ret = FALSE;
GString *config_data = NULL;
- gs_unref_object GFile *child = NULL;
- gs_unref_object GFile *grandchild = NULL;
+ g_autoptr(GFile) child = NULL;
+ g_autoptr(GFile) grandchild = NULL;
const char *mode_str;
if (!ostree_repo_mode_to_string (mode, &mode_str, error))
{
gboolean ret = FALSE;
GError *temp_error = NULL;
- gs_unref_object GFileEnumerator *ret_direnum = NULL;
+ g_autoptr(GFileEnumerator) ret_direnum = NULL;
ret_direnum = g_file_enumerate_children (dirpath, queryargs, queryflags,
cancellable, &temp_error);
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *etc_ostree_remotes_d = NULL;
- gs_unref_object GFileEnumerator *direnum = NULL;
+ g_autoptr(GFile) etc_ostree_remotes_d = NULL;
+ g_autoptr(GFileEnumerator) direnum = NULL;
etc_ostree_remotes_d = g_file_new_for_path (SYSCONFDIR "/ostree/remotes.d");
if (!enumerate_directory_allow_noent (etc_ostree_remotes_d, OSTREE_GIO_FAST_QUERYINFO, 0,
if (parent_repo_path && parent_repo_path[0])
{
- gs_unref_object GFile *parent_repo_f = g_file_new_for_path (parent_repo_path);
+ g_autoptr(GFile) parent_repo_f = g_file_new_for_path (parent_repo_path);
self->parent_repo = ostree_repo_new (parent_repo_f);
gboolean ret = FALSE;
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
int fd = -1;
- gs_unref_object GInputStream *ret_stream = NULL;
+ g_autoptr(GInputStream) ret_stream = NULL;
gs_unref_variant GVariant *ret_variant = NULL;
g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE);
gboolean ret = FALSE;
struct stat stbuf;
int res;
- gs_unref_object GFileInfo *ret_info = NULL;
+ g_autoptr(GFileInfo) ret_info = NULL;
do
res = fstatat (self->objects_dir_fd, loose_path_buf, &stbuf, AT_SYMLINK_NOFOLLOW);
gboolean ret = FALSE;
gboolean found = FALSE;
OstreeRepoMode repo_mode;
- gs_unref_object GInputStream *ret_input = NULL;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GInputStream) ret_input = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
{
int fd = -1;
struct stat stbuf;
- gs_unref_object GInputStream *tmp_stream = NULL;
+ g_autoptr(GInputStream) tmp_stream = NULL;
if (!openat_allow_noent (self->objects_dir_fd, loose_path_buf, &fd,
cancellable, error))
}
else if (S_ISLNK (mode))
{
- gs_unref_object GInputStream *target_input = NULL;
+ g_autoptr(GInputStream) target_input = NULL;
char targetbuf[PATH_MAX+1];
gsize target_size;
{
gboolean ret = FALSE;
guint64 size;
- gs_unref_object GInputStream *ret_input = NULL;
+ g_autoptr(GInputStream) ret_input = NULL;
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
{
}
else
{
- gs_unref_object GInputStream *input = NULL;
- gs_unref_object GFileInfo *finfo = NULL;
+ g_autoptr(GInputStream) input = NULL;
+ g_autoptr(GFileInfo) finfo = NULL;
gs_unref_variant GVariant *xattrs = NULL;
if (!ostree_repo_load_file (self, checksum, &input, &finfo, &xattrs,
{
gboolean ret = FALSE;
gboolean ret_have_object;
- gs_unref_object GFile *loose_path = NULL;
+ g_autoptr(GFile) loose_path = NULL;
if (!_ostree_repo_find_object (self, objtype, checksum, &loose_path,
cancellable, error))
{
gboolean ret = FALSE;
guint64 length;
- gs_unref_object GInputStream *object = NULL;
+ g_autoptr(GInputStream) object = NULL;
if (!ostree_repo_load_object_stream (source, objtype, checksum,
&object, &length,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *ret_root = NULL;
+ g_autoptr(GFile) ret_root = NULL;
g_autofree char *resolved_commit = NULL;
if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error))
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *tmp_signature_file = NULL;
- gs_unref_object GOutputStream *tmp_signature_output = NULL;
+ g_autoptr(GFile) tmp_signature_file = NULL;
+ g_autoptr(GOutputStream) tmp_signature_output = NULL;
gpgme_ctx_t context = NULL;
gs_unref_bytes GBytes *ret_signature = NULL;
gpgme_engine_info_t info;
gs_unref_bytes GBytes *signature_data = NULL;
gs_unref_variant GVariant *commit_variant = NULL;
g_autofree char *delta_path = NULL;
- gs_unref_object GFile *delta_file = NULL;
+ g_autoptr(GFile) delta_file = NULL;
g_autofree char *detached_metadata_relpath = NULL;
- gs_unref_object GFile *detached_metadata_path = NULL;
+ g_autoptr(GFile) detached_metadata_path = NULL;
gs_unref_variant GVariant *existing_detached_metadata = NULL;
gs_unref_variant GVariant *normalized = NULL;
gs_unref_variant GVariant *new_metadata = NULL;
{
OstreeGpgVerifyResult *result = NULL;
gs_unref_variant GVariant *commit_variant = NULL;
- gs_unref_object GFile *keyringdir_ref = NULL;
+ g_autoptr(GFile) keyringdir_ref = NULL;
gs_unref_variant GVariant *metadata = NULL;
gs_unref_bytes GBytes *signed_data = NULL;
g_autofree char *commit_filename = NULL;
#ifdef HAVE_SELINUX
gboolean ret = FALSE;
OstreeSePolicy *self = OSTREE_SEPOLICY (initable);
- gs_unref_object GFile *etc_selinux_dir = NULL;
- gs_unref_object GFile *policy_config_path = NULL;
- gs_unref_object GFile *policy_root = NULL;
- gs_unref_object GFileInputStream *filein = NULL;
- gs_unref_object GDataInputStream *datain = NULL;
+ g_autoptr(GFile) etc_selinux_dir = NULL;
+ g_autoptr(GFile) policy_config_path = NULL;
+ g_autoptr(GFile) policy_root = NULL;
+ g_autoptr(GFileInputStream) filein = NULL;
+ g_autoptr(GDataInputStream) datain = NULL;
gboolean enabled = FALSE;
char *policytype = NULL;
const char *selinux_prefix = "SELINUX=";
{
#ifdef HAVE_SELINUX
gboolean ret = FALSE;
- gs_unref_object GFileInfo *src_info = NULL;
+ g_autoptr(GFileInfo) src_info = NULL;
g_autofree char *label = NULL;
gboolean do_relabel = TRUE;
{
gboolean ret = FALSE;
const char *osname = gs_file_get_basename_cached (osdir);
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *osdeploy_dir = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) osdeploy_dir = NULL;
GError *temp_error = NULL;
osdeploy_dir = g_file_get_child (osdir, "deploy");
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *deploydir = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) deploydir = NULL;
gs_unref_ptrarray GPtrArray *ret_deployments = NULL;
GError *temp_error = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *boot_ostree = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) boot_ostree = NULL;
gs_unref_ptrarray GPtrArray *ret_bootdirs = NULL;
GError *temp_error = NULL;
gboolean ret = FALSE;
int cleanup_bootversion;
int cleanup_subbootversion;
- gs_unref_object GFile *cleanup_boot_dir = NULL;
+ g_autoptr(GFile) cleanup_boot_dir = NULL;
cleanup_bootversion = self->bootversion == 0 ? 1 : 0;
cleanup_subbootversion = self->subbootversion == 0 ? 1 : 0;
for (i = 0; i < removed->len; i++)
{
GFile *file = removed->pdata[i];
- gs_unref_object GFile *target_file = NULL;
+ g_autoptr(GFile) target_file = NULL;
g_autofree char *path = NULL;
path = g_file_get_relative_path (orig_etc, file);
const char *csum = ostree_deployment_get_csum (deployment);
g_autofree char *checkout_target_name = NULL;
g_autofree char *osdeploy_path = NULL;
- gs_unref_object GFile *ret_deploy_target_path = NULL;
+ g_autoptr(GFile) ret_deploy_target_path = NULL;
glnx_fd_close int osdeploy_dfd = -1;
int ret_fd;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *direnum = NULL;
+ g_autoptr(GFileEnumerator) direnum = NULL;
if (!relabel_one_path (sysroot, sepolicy, dir, dir_info, path_parts,
cancellable, error))
{
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
- gs_unref_object GFileInfo *root_info = NULL;
+ g_autoptr(GFileInfo) root_info = NULL;
root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
- gs_unref_object GFileInfo *file_info = g_file_query_info (path, OSTREE_GIO_FAST_QUERYINFO,
+ g_autoptr(GFileInfo) file_info = g_file_query_info (path, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
if (!file_info)
* point in the distant future to only create (and label) /var
* when doing a deployment.
*/
- gs_unref_object GFile *deployment_var_labeled =
+ g_autoptr(GFile) deployment_var_labeled =
g_file_get_child (deployment_var_path, ".ostree-selabeled");
- gs_unref_object GFile *deployment_var_labeled_tmp =
+ g_autoptr(GFile) deployment_var_labeled_tmp =
g_file_get_child (deployment_var_path, ".ostree-selabeled.tmp");
if (!g_file_query_exists (deployment_var_labeled, NULL))
{
gboolean ret = FALSE;
g_autofree char *deployment_abspath = glnx_fdrel_abspath (deployment_dfd, ".");
- gs_unref_object GFile *deployment_path = g_file_new_for_path (deployment_abspath);
- gs_unref_object GFile *source_etc_path = NULL;
- gs_unref_object GFile *source_etc_pristine_path = NULL;
- gs_unref_object GFile *deployment_usretc_path = NULL;
- gs_unref_object GFile *deployment_etc_path = NULL;
+ g_autoptr(GFile) deployment_path = g_file_new_for_path (deployment_abspath);
+ g_autoptr(GFile) source_etc_path = NULL;
+ g_autoptr(GFile) source_etc_pristine_path = NULL;
+ g_autoptr(GFile) deployment_usretc_path = NULL;
+ g_autoptr(GFile) deployment_etc_path = NULL;
gs_unref_object OstreeSePolicy *sepolicy = NULL;
gboolean etc_exists;
gboolean usretc_exists;
if (previous_deployment)
{
- gs_unref_object GFile *previous_path = NULL;
+ g_autoptr(GFile) previous_path = NULL;
OstreeBootconfigParser *previous_bootconfig;
previous_path = ostree_sysroot_get_deployment_directory (sysroot, previous_deployment);
if (origin)
{
- gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
- gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
- gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path);
+ g_autoptr(GFile) deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
+ g_autoptr(GFile) origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
+ g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path);
g_autofree char *contents = NULL;
gsize len;
gs_unref_bytes GBytes *contents_bytes = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *ostree_bootdir
+ g_autoptr(GFile) ostree_bootdir
= g_file_resolve_relative_path (deployroot, "usr/lib/ostree-boot");
- gs_unref_object GFile *bootdir = g_file_get_child (deployroot, "boot");
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *ret_kernel = NULL;
- gs_unref_object GFile *ret_initramfs = NULL;
+ g_autoptr(GFile) bootdir = g_file_get_child (deployroot, "boot");
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) ret_kernel = NULL;
+ g_autoptr(GFile) ret_initramfs = NULL;
g_autofree char *kernel_checksum = NULL;
g_autofree char *initramfs_checksum = NULL;
guint i;
int old_subbootversion;
int new_subbootversion;
- gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree");
+ g_autoptr(GFile) ostree_dir = g_file_get_child (self->path, "ostree");
g_autofree char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion);
- gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
+ g_autoptr(GFile) ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
g_autofree char *ostree_subbootdir_name = NULL;
- gs_unref_object GFile *ostree_subbootdir = NULL;
+ g_autoptr(GFile) ostree_subbootdir = NULL;
if (bootversion != self->bootversion)
{
ostree_deployment_get_osname (deployment),
ostree_deployment_get_csum (deployment),
ostree_deployment_get_deployserial (deployment));
- gs_unref_object GFile *linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
- gs_unref_object GFile *linkname_parent = g_file_get_parent (linkname);
+ g_autoptr(GFile) linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
+ g_autoptr(GFile) linkname_parent = g_file_get_parent (linkname);
if (!ot_util_ensure_directory_and_fsync (linkname_parent, cancellable, error))
goto out;
struct stat stbuf;
const char *osname = ostree_deployment_get_osname (deployment);
const char *bootcsum = ostree_deployment_get_bootcsum (deployment);
- gs_unref_object GFile *bootdir = NULL;
- gs_unref_object GFile *bootcsumdir = NULL;
- gs_unref_object GFile *bootconfpath = NULL;
- gs_unref_object GFile *bootconfpath_parent = NULL;
+ g_autoptr(GFile) bootdir = NULL;
+ g_autoptr(GFile) bootcsumdir = NULL;
+ g_autoptr(GFile) bootconfpath = NULL;
+ g_autoptr(GFile) bootconfpath_parent = NULL;
g_autofree char *dest_kernel_name = NULL;
- gs_unref_object GFile *dest_kernel_path = NULL;
- gs_unref_object GFile *dest_initramfs_path = NULL;
- gs_unref_object GFile *tree_kernel_path = NULL;
- gs_unref_object GFile *tree_initramfs_path = NULL;
- gs_unref_object GFile *deployment_dir = NULL;
+ g_autoptr(GFile) dest_kernel_path = NULL;
+ g_autoptr(GFile) dest_initramfs_path = NULL;
+ g_autoptr(GFile) tree_kernel_path = NULL;
+ g_autoptr(GFile) tree_initramfs_path = NULL;
+ g_autoptr(GFile) deployment_dir = NULL;
glnx_fd_close int deployment_dfd = -1;
g_autofree char *contents = NULL;
g_autofree char *deployment_version = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *boot_loader_link = NULL;
+ g_autoptr(GFile) boot_loader_link = NULL;
g_autofree char *new_target = NULL;
g_assert ((current_bootversion == 0 && new_bootversion == 1) ||
{
OstreeDeployment *deployment = self->deployments->pdata[i];
const char *osname = ostree_deployment_get_osname (deployment);
- gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
- gs_unref_object GFile *legacy_link = g_file_get_child (osdir, "current");
+ g_autoptr(GFile) osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
+ g_autoptr(GFile) legacy_link = g_file_get_child (osdir, "current");
if (!ot_gfile_ensure_unlinked (legacy_link, cancellable, error))
goto out;
for (i = 0; i < new_deployments->len; i++)
{
OstreeDeployment *deployment = new_deployments->pdata[i];
- gs_unref_object GFile *deployment_root = NULL;
+ g_autoptr(GFile) deployment_root = NULL;
if (deployment == self->booted_deployment)
found_booted_deployment = TRUE;
{
int new_bootversion = self->bootversion ? 0 : 1;
gs_unref_object OstreeBootloader *bootloader = NULL;
- gs_unref_object GFile *new_loader_entries_dir = NULL;
+ g_autoptr(GFile) new_loader_entries_dir = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gboolean show_osname = FALSE;
gboolean ret = FALSE;
guint i;
int new_deployserial = 0;
- gs_unref_object GFile *osdir = NULL;
+ g_autoptr(GFile) osdir = NULL;
gs_unref_ptrarray GPtrArray *tmp_current_deployments =
g_ptr_array_new_with_free_func (g_object_unref);
gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_object OstreeRepo *repo = NULL;
- gs_unref_object GFile *osdeploydir = NULL;
- gs_unref_object GFile *deployment_var = NULL;
- gs_unref_object GFile *commit_root = NULL;
- gs_unref_object GFile *tree_kernel_path = NULL;
- gs_unref_object GFile *tree_initramfs_path = NULL;
+ g_autoptr(GFile) osdeploydir = NULL;
+ g_autoptr(GFile) deployment_var = NULL;
+ g_autoptr(GFile) commit_root = NULL;
+ g_autoptr(GFile) tree_kernel_path = NULL;
+ g_autoptr(GFile) tree_initramfs_path = NULL;
glnx_fd_close int deployment_dfd = -1;
gs_unref_object OstreeSePolicy *sepolicy = NULL;
g_autofree char *new_bootcsum = NULL;
ostree_sysroot_constructed (GObject *object)
{
OstreeSysroot *self = OSTREE_SYSROOT (object);
- gs_unref_object GFile *repo_path = NULL;
+ g_autoptr(GFile) repo_path = NULL;
g_assert (self->path != NULL);
OstreeSysroot*
ostree_sysroot_new_default (void)
{
- gs_unref_object GFile *rootfs = g_file_new_for_path ("/");
+ g_autoptr(GFile) rootfs = g_file_new_for_path ("/");
return ostree_sysroot_new (rootfs);
}
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *dir = NULL;
- gs_unref_object GFile *ostree_dir = NULL;
- gs_unref_object GFile *repo_dir = NULL;
+ g_autoptr(GFile) dir = NULL;
+ g_autoptr(GFile) ostree_dir = NULL;
+ g_autoptr(GFile) repo_dir = NULL;
ostree_dir = g_file_get_child (self->path, "ostree");
repo_dir = g_file_get_child (ostree_dir, "repo");
GFile *
ostree_sysroot_get_deployment_origin_path (GFile *deployment_path)
{
- gs_unref_object GFile *deployment_parent = g_file_get_parent (deployment_path);
+ g_autoptr(GFile) deployment_parent = g_file_get_parent (deployment_path);
return ot_gfile_resolve_path_printf (deployment_parent,
"%s.origin",
gs_file_get_path_cached (deployment_path));
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline");
+ g_autoptr(GFile) proc_cmdline = g_file_new_for_path ("/proc/cmdline");
g_autofree char *contents = NULL;
gsize len;
{
GChecksum *checksum = NULL;
char *ret = NULL;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GInputStream) in = NULL;
in = (GInputStream*)g_file_read (file, cancellable, error);
if (!in)
{
gboolean ret = FALSE;
const char *target;
- gs_unref_object GFile *path_parent = NULL;
- gs_unref_object GFile *ret_target = NULL;
+ g_autoptr(GFile) path_parent = NULL;
+ g_autoptr(GFile) ret_target = NULL;
if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_SYMBOLIC_LINK)
{
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileInfo *ret_file_info = NULL;
+ g_autoptr(GFileInfo) ret_file_info = NULL;
GError *temp_error = NULL;
ret_file_info = g_file_query_info (path, queryopts, flags,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileInfo *file_info = NULL;
- gs_unref_object GFile *ret_target = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
+ g_autoptr(GFile) ret_target = NULL;
if (!ot_gfile_query_info_allow_noent (path, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
gboolean ret = FALSE;
int fd;
g_autofree char *tmpname = NULL;
- gs_unref_object GOutputStream *stream = NULL;
- gs_unref_object GInputStream *instream = NULL;
+ g_autoptr(GOutputStream) stream = NULL;
+ g_autoptr(GInputStream) instream = NULL;
if (!gs_file_open_in_tmpdir_at (dfd, 0644,
&tmpname, &stream,
gboolean ret = FALSE;
int parent_dfd;
const char *target_basename = gs_file_get_basename_cached (path);
- gs_unref_object GFile *parent = NULL;
+ g_autoptr(GFile) parent = NULL;
parent = g_file_get_parent (path);
gboolean ret = FALSE;
int parentfd = -1;
const char *basename = gs_file_get_basename_cached (dir);
- gs_unref_object GFile *parent = g_file_get_parent (dir);
+ g_autoptr(GFile) parent = g_file_get_parent (dir);
again:
parentfd = open (gs_file_get_path_cached (parent),
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *parent = g_file_get_parent (path);
+ g_autoptr(GFile) parent = g_file_get_parent (path);
g_autofree char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL);
- gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname);
+ g_autoptr(GFile) tmppath = g_file_get_child (parent, tmpname);
int parent_dfd = -1;
if (!ot_gfile_ensure_unlinked (tmppath, cancellable, error))
if (out_pubring_stream != NULL)
{
GFileOutputStream *pubring_stream;
- glnx_unref_object GFile *pubring_file = NULL;
+ g_autoptr(GFile) pubring_file = NULL;
g_autofree char *pubring_path = NULL;
pubring_path = g_build_filename (tmp_home_dir, "pubring.gpg", NULL);
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GOutputStream *out = NULL;
+ g_autoptr(GOutputStream) out = NULL;
gsize bytes_written;
out = (GOutputStream*)g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GMemoryOutputStream *data_stream = NULL;
+ g_autoptr(GMemoryOutputStream) data_stream = NULL;
gs_unref_variant GVariant *ret_variant = NULL;
data_stream = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
gs_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
gs_unref_object OstreeDeployment *deployment = NULL;
- gs_unref_object GFile *deployment_dir = NULL;
+ g_autoptr(GFile) deployment_dir = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL;
gs_unref_ptrarray GPtrArray *removed = NULL;
gs_unref_ptrarray GPtrArray *added = NULL;
- gs_unref_object GFile *orig_etc_path = NULL;
- gs_unref_object GFile *new_etc_path = NULL;
+ g_autoptr(GFile) orig_etc_path = NULL;
+ g_autoptr(GFile) new_etc_path = NULL;
context = g_option_context_new ("Diff current /etc configuration versus default");
GOptionContext *context;
gs_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
- gs_unref_object GFile *dir = NULL;
- gs_unref_object GFile *child = NULL;
+ g_autoptr(GFile) dir = NULL;
+ g_autoptr(GFile) child = NULL;
gs_unref_object OstreeSysroot *target_sysroot = NULL;
guint i;
const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
gs_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
const char *osname = NULL;
- gs_unref_object GFile *deploy_dir = NULL;
- gs_unref_object GFile *dir = NULL;
+ g_autoptr(GFile) deploy_dir = NULL;
+ g_autoptr(GFile) dir = NULL;
context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
{ g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
gs_unref_keyfile GKeyFile *new_origin = NULL;
- gs_unref_object GFile *origin_path = NULL;
+ g_autoptr(GFile) origin_path = NULL;
new_origin = ostree_sysroot_origin_new_from_refspec (sysroot, new_refspec);
g_autofree char *new_ref = NULL;
g_autofree char *new_refspec = NULL;
g_autofree char *new_revision = NULL;
- gs_unref_object GFile *deployment_path = NULL;
- gs_unref_object GFile *deployment_origin_path = NULL;
+ g_autoptr(GFile) deployment_path = NULL;
+ g_autoptr(GFile) deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_object OstreeSysrootUpgrader *upgrader = NULL;
goto out;
{
- gs_unref_object GFile *real_sysroot = g_file_new_for_path ("/");
+ g_autoptr(GFile) real_sysroot = g_file_new_for_path ("/");
if (opt_reboot && g_file_equal (ostree_sysroot_get_path (sysroot), real_sysroot))
{
g_autofree char *origin_ref = NULL;
g_autofree char *origin_refspec = NULL;
g_autofree char *new_revision = NULL;
- gs_unref_object GFile *deployment_path = NULL;
- gs_unref_object GFile *deployment_origin_path = NULL;
+ g_autoptr(GFile) deployment_path = NULL;
+ g_autoptr(GFile) deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_object OstreeDeployment *new_deployment = NULL;
GSConsole *console = NULL;
}
else
{
- gs_unref_object GFile *real_sysroot = g_file_new_for_path ("/");
+ g_autoptr(GFile) real_sysroot = g_file_new_for_path ("/");
if (!ostree_sysroot_upgrader_deploy (upgrader, cancellable, error))
goto out;
{
gboolean ret = FALSE;
guint bootversion;
- gs_unref_object GFile *subpath = NULL;
+ g_autoptr(GFile) subpath = NULL;
gs_unref_object OstreeSePolicy *sepolicy = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
GOptionContext *context = NULL;
gs_unref_object OstreeSysroot *sysroot = NULL;
- gs_unref_object GFile *deployment_path = NULL;
+ g_autoptr(GFile) deployment_path = NULL;
context = g_option_context_new ("[BOOTVERSION] - generate GRUB2 configuration from given BLS entries");
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *direnum = NULL;
+ g_autoptr(GFileEnumerator) direnum = NULL;
if (!relabel_one_path (sepolicy, dir, dir_info, path_parts,
cancellable, error))
{
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
- gs_unref_object GFileInfo *root_info = NULL;
+ g_autoptr(GFileInfo) root_info = NULL;
root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
{
gboolean ret = FALSE;
const char *policy_name;
- gs_unref_object GFile *subpath = NULL;
+ g_autoptr(GFile) subpath = NULL;
const char *prefix = NULL;
gs_unref_object OstreeSePolicy *sepolicy = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
OstreeDeployment *first_deployment;
GOptionContext *context = NULL;
gs_unref_object OstreeSysroot *sysroot = NULL;
- gs_unref_object GFile *deployment_path = NULL;
+ g_autoptr(GFile) deployment_path = NULL;
context = g_option_context_new ("[SUBPATH PREFIX] - relabel all or part of a deployment");
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GInputStream) in = NULL;
in = (GInputStream*)g_file_read (f, cancellable, error);
if (!in)
gboolean ret = FALSE;
int i;
const char *rev;
- gs_unref_object GOutputStream *stdout_stream = NULL;
- gs_unref_object GFile *root = NULL;
- gs_unref_object GFile *f = NULL;
+ g_autoptr(GOutputStream) stdout_stream = NULL;
+ g_autoptr(GFile) root = NULL;
+ g_autoptr(GFile) f = NULL;
context = g_option_context_new ("COMMIT PATH... - Concatenate contents of files");
else
{
GError *tmp_error = NULL;
- gs_unref_object GFile *root = NULL;
- gs_unref_object GFile *subtree = NULL;
- gs_unref_object GFileInfo *file_info = NULL;
- gs_unref_object GFile *destination_file = g_file_new_for_path (destination);
+ g_autoptr(GFile) root = NULL;
+ g_autoptr(GFile) subtree = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
+ g_autoptr(GFile) destination_file = g_file_new_for_path (destination);
if (!ostree_repo_read_commit (repo, resolved_commit, &root, NULL, cancellable, error))
goto out;
gboolean ret = FALSE;
gsize len;
GError *temp_error = NULL;
- gs_unref_object GInputStream *instream = NULL;
- gs_unref_object GDataInputStream *datastream = NULL;
+ g_autoptr(GInputStream) instream = NULL;
+ g_autoptr(GDataInputStream) datastream = NULL;
g_autofree char *revision = NULL;
g_autofree char *subpath = NULL;
g_autofree char *resolved_commit = NULL;
}
else
{
- gs_unref_object GFile *f = g_file_new_for_path (opt_from_file);
+ g_autoptr(GFile) f = g_file_new_for_path (opt_from_file);
instream = (GInputStream*)g_file_read (f, cancellable, error);
if (!instream)
{
GOptionContext *context;
gboolean ret = FALSE;
- gs_unref_object GFile *f = NULL;
+ g_autoptr(GFile) f = NULL;
AsyncChecksumData data = { 0, };
context = g_option_context_new ("PATH - Checksum a file or directory");
gsize len;
char **iter = NULL; /* nofree */
gs_unref_hashtable GHashTable *ret_hash = NULL;
- gs_unref_object GFile *path = NULL;
+ g_autoptr(GFile) path = NULL;
g_autofree char *contents = NULL;
char **lines = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
gboolean skip_commit = FALSE;
- gs_unref_object GFile *arg = NULL;
+ g_autoptr(GFile) arg = NULL;
g_autofree char *parent = NULL;
g_autofree char *commit_checksum = NULL;
- gs_unref_object GFile *root = NULL;
+ g_autoptr(GFile) root = NULL;
gs_unref_variant GVariant *metadata = NULL;
gs_unref_variant GVariant *detached_metadata = NULL;
gs_unref_object OstreeMutableTree *mtree = NULL;
if (opt_skip_if_unchanged && parent)
{
- gs_unref_object GFile *parent_root;
+ g_autoptr(GFile) parent_root;
if (!ostree_repo_read_commit (repo, parent, &parent_root, NULL, cancellable, error))
goto out;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *ret_file = NULL;
+ g_autoptr(GFile) ret_file = NULL;
if (g_str_has_prefix (arg, "/")
|| g_str_has_prefix (arg, "./")
const char *src;
const char *target;
g_autofree char *src_prev = NULL;
- gs_unref_object GFile *srcf = NULL;
- gs_unref_object GFile *targetf = NULL;
+ g_autoptr(GFile) srcf = NULL;
+ g_autoptr(GFile) targetf = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL;
gs_unref_ptrarray GPtrArray *removed = NULL;
gs_unref_ptrarray GPtrArray *added = NULL;
gboolean ret = FALSE;
gboolean missing = FALSE;
gs_unref_variant GVariant *metadata = NULL;
- gs_unref_object GInputStream *input = NULL;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GInputStream) input = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
gs_unref_variant GVariant *xattrs = NULL;
GError *temp_error = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFileEnumerator *dir_enum = NULL;
- gs_unref_object GFile *child = NULL;
- gs_unref_object GFileInfo *child_info = NULL;
+ g_autoptr(GFileEnumerator) dir_enum = NULL;
+ g_autoptr(GFile) child = NULL;
+ g_autoptr(GFileInfo) child_info = NULL;
GError *temp_error = NULL;
if (depth > 0)
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *f = NULL;
- gs_unref_object GFileInfo *file_info = NULL;
+ g_autoptr(GFile) f = NULL;
+ g_autoptr(GFileInfo) file_info = NULL;
f = g_file_resolve_relative_path (root, arg);
gboolean ret = FALSE;
const char *rev;
int i;
- gs_unref_object GFile *root = NULL;
+ g_autoptr(GFile) root = NULL;
context = g_option_context_new ("COMMIT [PATH...] - List file paths");
if (argc == 2)
{
- gs_unref_object GFile *src_repo_path = g_file_new_for_path (src_repo_arg);
+ g_autoptr(GFile) src_repo_path = g_file_new_for_path (src_repo_arg);
gs_unref_object OstreeRepo *src_repo = ostree_repo_new (src_repo_path);
gs_unref_hashtable GHashTable *refs_to_clone = NULL;
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object GFile *f = NULL;
+ g_autoptr(GFile) f = NULL;
gs_unref_variant GVariant *variant = NULL;
f = g_file_new_for_path (filename);
{
gs_unref_object OstreeGpgVerifyResult *result = NULL;
GError *local_error = NULL;
- gs_unref_object GFile *gpg_homedir = opt_gpg_homedir ? g_file_new_for_path (opt_gpg_homedir) : NULL;
+ g_autoptr(GFile) gpg_homedir = opt_gpg_homedir ? g_file_new_for_path (opt_gpg_homedir) : NULL;
result = ostree_repo_verify_commit_ext (repo, checksum,
gpg_homedir, NULL, NULL,
goto out;
if (!found)
{
- gs_unref_object GFileInfo *finfo = NULL;
+ g_autoptr(GFileInfo) finfo = NULL;
gs_unref_variant GVariant *xattrs = NULL;
GFileType filetype;
{
gboolean ret = FALSE;
const char *patharg;
- gs_unref_object GFile *path = NULL;
+ g_autoptr(GFile) path = NULL;
GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL;
OtTrivialHttpd appstruct = { 0, };
OtTrivialHttpd *app = &appstruct;
gs_unref_object SoupServer *server = NULL;
- gs_unref_object GFileMonitor *dirmon = NULL;
+ g_autoptr(GFileMonitor) dirmon = NULL;
context = g_option_context_new ("[DIR] - Simple webserver");
g_autofree char *portstr = NULL;
#if SOUP_CHECK_VERSION(2, 48, 0)
GSList *listeners = soup_server_get_listeners (server);
- gs_unref_object GSocket *listener = NULL;
- gs_unref_object GSocketAddress *addr = NULL;
+ g_autoptr(GSocket) listener = NULL;
+ g_autoptr(GSocketAddress) addr = NULL;
g_assert (listeners);
listener = g_object_ref (listeners->data);
if (opt_autoexit)
{
gboolean is_symlink = FALSE;
- gs_unref_object GFileInfo *info = NULL;
+ g_autoptr(GFileInfo) info = NULL;
info = g_file_query_info (app->root,
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
{
gs_unref_object GSSubprocessContext *ctx = NULL;
gs_unref_object GSSubprocess *proc = NULL;
- gs_unref_object GFile *file = NULL;
- gs_unref_object GFileIOStream *io = NULL;
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GFileIOStream) io = NULL;
GOutputStream *output;
const char *editor;
char *ret = NULL;
}
else if (opt_repo != NULL)
{
- gs_unref_object GFile *repo_file = g_file_new_for_path (opt_repo);
+ g_autoptr(GFile) repo_file = g_file_new_for_path (opt_repo);
repo = ostree_repo_new (repo_file);
if (!(flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
GCancellable *cancellable,
GError **error)
{
- gs_unref_object GFile *sysroot_path = NULL;
+ g_autoptr(GFile) sysroot_path = NULL;
gs_unref_object OstreeSysroot *sysroot = NULL;
gboolean success = FALSE;
{
gs_unref_ptrarray GPtrArray *deployments = NULL;
OstreeDeployment *first_deployment;
- gs_unref_object GFile *deployment_file = NULL;
+ g_autoptr(GFile) deployment_file = NULL;
g_autofree char *deployment_path = NULL;
if (!ostree_sysroot_load (sysroot, cancellable, error))
const char *remote_url;
char **iter;
g_autofree char *target_name = NULL;
- glnx_unref_object GFile *target_conf = NULL;
+ g_autoptr(GFile) target_conf = NULL;
g_autoptr(GVariantBuilder) optbuilder = NULL;
gboolean ret = FALSE;
g_autofree guint8 *old = g_new (guint8, OLD_SIZE);
g_autofree guint8 *new = g_new (guint8, NEW_SIZE);
g_autofree guint8 *new_generated = g_new0 (guint8, NEW_SIZE);
- gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
- gs_unref_object GInputStream *in = NULL;
+ g_autoptr(GOutputStream) out = g_memory_output_stream_new_resizable ();
+ g_autoptr(GInputStream) in = NULL;
new[0] = 'A';
for (i = 0; i < OLD_SIZE; i++)